package skipManage

import (
	"gorm.io/gorm"
	"main/src/apps/contentManage"
	"main/src/apps/siteManage"
)

// Skip 跳转模型
type Skip struct {
	gorm.Model
	Id  int    `gorm:"type:int(11);primaryKey;autoIncrement"`
	URL string `gorm:"type:varchar(255);not null"` // URL
	Cat int    `gorm:"type:int(11);not null"`      // 所属品类
}

type Cat struct {
	gorm.Model
	Id       int                     `gorm:"type:int(11);primaryKey;autoIncrement"`
	Name     string                  `gorm:"type:varchar(32);not null"` // 所属品类
	Skips    []Skip                  `gorm:"foreignKey:Cat;association_foreignKey:Id"`
	Keywords []contentManage.KeyWord `gorm:"foreignKey:Cat;association_foreignKey:Id"`
	Images   []contentManage.Image   `gorm:"foreignKey:Cat;association_foreignKey:Id"`
	Domains  []siteManage.Domain     `gorm:"foreignKey:Cat;association_foreignKey:Id"`
}

func (c *Cat) TableName() string {
	return "cat"
}

func (s Skip) TableName() string {
	return "skip"
}
